Barcode Xpress for Linux v13.1 - Updated
Analyze Barcodes
User Guide > How To > Analyze Barcodes

Once your image has been acquired and pre-image processing has been performed to recognize the barcode on the image, some properties must first be set.

The recognition properties are defined in BX_AnalyzeParameters. BX_DefaultAnalyzeParameters is the defaults settings for recognizing barcodes.

Barcode Xpress for Linux detects all barcodes in an image and gives you complete details about them.

Supported Barcodes for Recognition

Barcodes supported for recognition are listed in the Overview of Barcode Xpress for Linux.

Once the BarcodeTypes property has been determined as stated in the Acquire an Image for Barcode Recognition topic, use the following methods and properties to recognize the barcode.

Methods

Method Description
BX_analyze_file Detects barcodes within the given bitmap image.
BX_analyze_dib Detects barcodes within the given handle to a DIB (Device Independent Bitmap).
BX_analyze_bmp Detects barcodes within the given handle to a bitmap image.
Copy Code
// The BX_set_solution_name and BX_set_solution_key methods must be called to distribute the runtime.
BX_set_solution_name("YourSolutionName");
BX_set_solution_key(12345, 12345, 12345, 12345);
 
// The BX_set_oem_license_key is required if Manually Reported Runtime Licensing is used.
// BX_set_oem_license_key("2.0.AStringForOEMLicensing");
 
// Initialize default analyze parameters and prepare result holder
BX_AnalyzeParameters params = BX_DefaultAnalyzeParameters;
BX_AnalyzeResult result;
BX_Status status;
 
// call BX_analyze_file, BX_analyze_dib, or BX_analyze_bmp to detect barcodes in the image
status = BX_analyze_file( &params, fileName, &result );
if( BX_Status_OK != status ) {
    printf("ERRORS:\n");
    for( int i=0; i<result.ErrorCount; ++i ) {
        BX_Error *error = &(result.BarcodeErrors[i]);
        printf("\t%d: %s\n\t%s\n", error->errorStatus, error->errorID, error->errorMessage);
    }
    return;
}
 
if( 0 == result.BarcodeResultsLength ) {
    printf("No results\n");
    BX_free_analyze_result( &result );
    exit(0);
}
 
// all detected barcodes will be returned to the
// BarcodeResults object array.
for( int i=0; i<result.BarcodeResultsLength; ++i ) {
    BX_BarcodeResult *res = &result.BarcodeResults[i];
    printf("Result #%d\n", i+1);
    printf("\tValue: %s\n", res->Value);
}
 
// Free results' data
BX_free_analyze_result( &result );

See the Acquire an Image for Barcode Recognition topic for code examples.

To obtain the results after analyzing the barcode on an image, see the Access Results topic.